]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[AppDisplay] In search/browse, show existing window instead of always launching
authorColin Walters <walters@verbum.org>
Wed, 9 Sep 2009 20:43:29 +0000 (16:43 -0400)
committerColin Walters <walters@verbum.org>
Wed, 9 Sep 2009 20:49:26 +0000 (16:49 -0400)
This brings search in line with the AppWell behavior which is definitely
right.  For browse we probably want more options.

js/ui/appDisplay.js

index cc93fd18bac5d7bd38d0d57d5b8e06d2e38f6042..c12f57529bdaf2abc777903b2590a96017e24c00 100644 (file)
@@ -78,7 +78,13 @@ AppDisplayItem.prototype = {
 
     // Opens an application represented by this display item.
     launch : function() {
-        this._appInfo.launch();
+        let windows = Shell.AppMonitor.get_default().get_windows_for_app(this._appInfo.get_id());
+        if (windows.length > 0) {
+            let mostRecentWindow = windows[0];
+            Main.overview.activateWindow(mostRecentWindow, Clutter.get_current_event_time());
+        } else {
+            this._appInfo.launch();
+        }
     },
 
     //// Protected method overrides ////